using Microsoft.AspNetCore.Mvc;

namespace ControllersAndActions.Controllers
{
  public class HomeController:Controller
  {
    public ViewResult Index()
    {
      return View("SimpleForm");
    }
    [HttpPost]
    public RedirectToActionResult ReceiveForm(string name,string city)
    {
      TempData["name"] = name;
      TempData["city"]=city;
      return RedirectToAction(nameof(Data));
    }
    public ViewResult Data()
    {
      string name = TempData["name"] as string;
      string city = TempData["city"] as string;
      return View("Result", $"{name} lives in {city}");
    }
  }
}
